package com.kymatrix.mpo.plus.bpm.server.model.form.listener;

import com.kymatrix.mpo.plus.bpm.server.model.entity.definition.BpmProcessListenerEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.experimental.Accessors;

@ApiModel(value = "管理后台 - BPM 流程监听器 Response")
@Data
@Accessors(chain=true)
public class QueryBpmProcessListenerResp {

    @ApiModelProperty(value = "编号", example = "13089")
    private String id;

    @ApiModelProperty(value = "监听器名字", example = "赵六")
    private String name;

    @ApiModelProperty(value = "监听器类型", example = "execution")
    private String type;

    @ApiModelProperty(value = "监听器状态 EnableType", example = "1")
    private String status;

    @ApiModelProperty(value = "监听事件", example = "start")
    private String event;

    @ApiModelProperty(value = "监听器值类型", example = "class")
    private String valueType;

    @ApiModelProperty(value = "监听器值")
    private String value;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;
    
    public static QueryBpmProcessListenerResp fromEntity(BpmProcessListenerEntity entity) {
        if (entity == null) {
            return null;
        }
        QueryBpmProcessListenerResp resp = new QueryBpmProcessListenerResp();
        resp.setId(entity.getId());
        resp.setName(entity.getName());
        resp.setType(entity.getType());
        resp.setStatus(entity.getStatus());
        resp.setEvent(entity.getEvent());
        resp.setValueType(entity.getValueType());
        resp.setValue(entity.getValue());
        resp.setCreateTime(entity.getCreateTime());
        return resp;
        
    } 
    

}
